1. Technical Field
The present invention relates in general to power management and in particular to restoring prior device states in a data processing system after a reduced power mode. More particularly, the present invention relates to reducing restoration time of device states for devices that have been in sleep mode.
2. Description of the Related Art
Modern computer hardware, particularly mobile computers such as laptops and notebooks, support multiple power levels. One such level, often referred to as "sleep mode," removes power from selected, nonessential devices after a predetermined period of inactivity. Facilities are generally provided to "wake" the data processing system by restoration of power to the selected devices to resume normal operation. This power level is particularly advantageous in data processing systems having finite available power, such as those operating on a battery.
Power management is the process of controlling the electric power consumption of data processing systems by selectively cutting off power to various parts of the system, thereby disabling those devices. A device driver which is able to prepare for and recover from the loss and restoration of power is said to be "power management aware." Ideally, a power management aware device driver should minimize the user's perceived disruption of computer services during a power management cycle. Thus, the state of the adapter, device drivers, and applications after the restoration of power should be as close to the pre-shutdown state as possible. However, not all devices within a data processing system are power management aware. Some devices must be re-initialized on power restoration.
When power is removed from a device, the contents of any internal registers and volatile memory is generally lost. For example, a display adapter will lose the contents of any internal display cache, which may include information regarding user selections for resolution, color depth, etc. When power is restored, the display adapter device driver must re-initialize the internal registers and memory, usually by making numerous time consuming calls to the operating system to retrieve initialization data. Additionally, nonpersistent data, which is not normally stored in a nonvolatile memory but is merely generated as a result of user activity, must be saved before power down and then retrieved on power restoration. Thus, restoration of power to the device and returning to a previous wake state may be a slow and somewhat difficult process.
In FIG. 4, a high-level flow diagram of a known process for restoring device states within a data processing system after the data processing system returns from sleep mode, is depicted. The process begins with step 400, which depicts a computer beginning a state of user input activity. The process continues with step 402, which illustrates a determination of the time passed with no activity. The process passes to step 404, which depicts a determination of whether or not the period of time set for beginning of sleep mode has been reached. If not the process returns to step 402 and continues to check for a pre-defined period of inactivity. If the period signaling sleep mode has been reached, the process instead proceeds to step 406, which illustrates a device driver determining the characteristics of its device state that must be saved in order to power-up properly. Since device drivers are generally not aware of hard disk drives or other nonvolatile memory in the system, most device drivers can only save to the system's random access memory (RAM). Characteristics are stored, typically to RAM, at the discretion of the device driver for later retrieval when restoration from sleep mode commences.
The process then proceeds to step 408, which illustrates the device driver saving the state of the device to the location in RAM designated by that individual device. It is possible, but not common, that devices within the computer may save device state to any storage medium with in the data processing system. If device states are stored on separate storage sites individual device state retrieval varies with the response time of the storage medium (disk, ram, flashcard, etc.). If stored on RAM, the retrieval time may be short but, if stored on disk, retrieval time may be relatively long.
The process next proceeds to step 410, which depicts powering down a device after device state has been stored. The process next passes to step 412, which depicts a determination of whether there are more device drivers with requirements to store device states into save locations. If there are more device states to be saved, the process returns to step 406 and repeats the cycle until all device states have been stored. If there are no more device drivers with storage requirements the process passes to step 414, which depicts the computer in sleep mode, awaiting an interrupt that would signal the end of sleep mode.
The problem of restoring power and returning to a previous wake state has been handled in laptop computers by providing device driver specific implementations of state saving. Often, the machine's entire state is saved to a hard drive. The state would be persistently stored but there are disadvantages to this solution. Saving large amounts of memory can be time consuming and restoration time may be nearly the same length as booting the system. In a laptop, the slow restoration time may be tolerated but for network machines without a hard drive, sending and retrieving its entire state across a network connection is time consuming and not desirable.
It would be desirable, therefore, to provide a method and apparatus for saving device state in a persistent condition. It would further be desirable to restore the device state quickly when power is re-applied from a reduced power mode.